package com.gxwz.medical.web.taglib;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.gxwz.medical.vo.UserContext;

/**
 * 
 * 自定义权限标签
 * 
 * @author: amu_1115@126.com
 * @date: 2017-6-22 上午06:48:28
 * @version V1.0
 */
public abstract class SecureTag extends TagSupport {

	public SecureTag() {
	}

	/**
	 * 获得当前用户的信息
	 * 
	 * @return
	 */
	protected UserContext getCurrentUserInfo(String user) {
		return (UserContext) pageContext.getSession().getAttribute("user");
	}

	protected void verifyAttributes() throws JspException {

	}

	public int doStartTag() throws JspException {
		try {
			verifyAttributes();
			return onDoStartTag();
		} catch (JspException e) {
			throw e;
		}

	}

	public abstract int onDoStartTag() throws JspException;

}
